import org.example.entity.CalculateProto;
import org.example.entity.Calculatepojo;
import org.example.interceptor.RpcInterceptor;
import org.example.service.CalculateService;

public class clientMain {


    public static void main(String[] args) {
        // 初始化
        CalculateService p = (CalculateService) RpcInterceptor.createProxy(new CalculateService());
        Calculatepojo pojo = new Calculatepojo();
        pojo.setId(1);
        pojo.setSuccess(false);
        pojo.setMsg("");
        pojo.setNumLeft(3d);
        pojo.setNumRight(4d);
        pojo.setOperator("add");
        pojo.setResult(0d);
        //调用计算方法
        p.calculate(pojo);
        //输出结果
        if(pojo.getSuccess()){
            System.out.println("计算成功！" + pojo.getMsg() + "算式结果为：" + pojo.getNumLeft()+ " " + pojo.getOperator() + " " + pojo.getNumRight() + " = " + pojo.getResult());
        }else{
            System.out.println("计算失败！" + pojo.getMsg());
        }
    }
}
